package com.twu.biblioteca;

/**
 * Created with IntelliJ IDEA.
 * User: Deepika
 * Date: 5/31/13
 * Time: 12:25 AM
 * To change this template use File | Settings | File Templates.
 */
class User {
    static private Integer usernameCount = 1111111;
    private String name;
    private String email;
    private String number;
    private String username;
    private String password;

    User(String name, String email, String number, String password){
        this.name = name;
        this.email = email;
        this.number = number;
        this.password = password;
        this.username = setUsername();
        usernameCount = usernameCount + 1;
    }

    public String getName(){
        return(this.name);
    }

    public String getNumber(){
        return(this.number);
    }

    public String getEmail(){
        return(this.email);
    }

    public String getUsername(){
        return(this.username);
    }

    public String getPassword(){
        return(this.password);
    }

    public String setUsername(){
        String firstPartUsername = Integer.toString(usernameCount).substring(0, 3);

        String secondPartUsername = Integer.toString(usernameCount).substring(3);
        String username = firstPartUsername + "-" + secondPartUsername;
        return(username);
    }

}
